#ifndef __SG_PCL_GIF_WRITER_H__
#define __SG_PCL_GIF_WRITER_H__

//#include "../3rd/gif.h"
#include "SGPCLBaseInfo.h"
#include <cstdint>
#include <pcl/io/ply_io.h>
#include <pcl/io/png_io.h>

namespace sgpcl
{

template <typename PointT>
std::vector<std::uint8_t> GetImgData(
  typename pcl::io::PointCloudImageExtractor<PointT>::Ptr spExtractor,
  const pcl::PointCloud<PointT>& cloud)
{
  pcl::PCLImage image;
  if (spExtractor->extract(cloud, image))
  {
    return image.data;
  }
  else
  {
    SG_PANIC("生成图片失败");
  }
}

/// <summary>
/// 将输入点云输出为PLY文件
/// </summary>
/// <typeparam name="PointT">点云类型</typeparam>
/// <param name="cloud">输入点云</param>
template <typename PointT>
void SaveAsPLY(const pcl::PointCloud<PointT>& cloud, const std::string& strFileName)
{
  SG_TIMER("输出为PLY文件");
  pcl::io::savePLYFileASCII(strFileName, cloud);
}

}
#endif // !__SG_PCL_GIF_WRITER_H__
